from tools.treeNode import Tree


# 前序遍历
def preOrderTraversal(root):
    if not root: return []
    left = preOrderTraversal(root.left)
    right = preOrderTraversal(root.right)
    return [root.val] + left + right


root = Tree(10)
root.left = Tree(2)
root.left.left = Tree(4)
root.left.right = Tree(5)
root.right = Tree(3)
root.right.left = Tree(6)
root.right.right = Tree(7)
print(preOrderTraversal(root))
